<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Copyright (C) 1988-2017 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "Free Software" and "Free Software Needs
Free Documentation", with the Front-Cover Texts being "A GNU Manual,"
and with the Back-Cover Texts as in (a) below.

(a) The FSF's Back-Cover Text is: "You are free to copy and modify
this GNU Manual.  Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom." -->
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Debugging with GDB: GDB/MI General Design</title>

<meta name="description" content="Debugging with GDB: GDB/MI General Design">
<meta name="keywords" content="Debugging with GDB: GDB/MI General Design">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="GDB_002fMI.html#GDB_002fMI" rel="up" title="GDB/MI">
<link href="Context-management.html#Context-management" rel="next" title="Context management">
<link href="GDB_002fMI.html#GDB_002fMI" rel="prev" title="GDB/MI">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>


</head>

<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="GDB_002fMI-General-Design"></a>
<div class="header">
<p>
Next: <a href="GDB_002fMI-Command-Syntax.html#GDB_002fMI-Command-Syntax" accesskey="n" rel="next">GDB/MI Command Syntax</a>, Up: <a href="GDB_002fMI.html#GDB_002fMI" accesskey="u" rel="up">GDB/MI</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="GDB_002fMI-General-Design-1"></a>
<h3 class="section">27.1 <small>GDB/MI</small> General Design</h3>
<a name="index-GDB_002fMI-General-Design"></a>

<p>Interaction of a <small>GDB/MI</small> frontend with <small>GDB</small> involves three
parts&mdash;commands sent to <small>GDB</small>, responses to those commands
and notifications.  Each command results in exactly one response,
indicating either successful completion of the command, or an error.
For the commands that do not resume the target, the response contains the
requested information.  For the commands that resume the target, the
response only indicates whether the target was successfully resumed.
Notifications is the mechanism for reporting changes in the state of the
target, or in <small>GDB</small> state, that cannot conveniently be associated with
a command and reported as part of that command response.
</p>
<p>The important examples of notifications are:
</p><ul>
<li> Exec notifications.  These are used to report changes in
target state&mdash;when a target is resumed, or stopped.  It would not
be feasible to include this information in response of resuming
commands, because one resume commands can result in multiple events in
different threads.  Also, quite some time may pass before any event
happens in the target, while a frontend needs to know whether the resuming
command itself was successfully executed.

</li><li> Console output, and status notifications.  Console output
notifications are used to report output of CLI commands, as well as
diagnostics for other commands.  Status notifications are used to
report the progress of a long-running operation.  Naturally, including
this information in command response would mean no output is produced
until the command is finished, which is undesirable.

</li><li> General notifications.  Commands may have various side effects on
the <small>GDB</small> or target state beyond their official purpose.  For example,
a command may change the selected thread.  Although such changes can
be included in command response, using notification allows for more
orthogonal frontend design.

</li></ul>

<p>There&rsquo;s no guarantee that whenever an MI command reports an error,
<small>GDB</small> or the target are in any specific state, and especially,
the state is not reverted to the state before the MI command was
processed.  Therefore, whenever an MI command results in an error, 
we recommend that the frontend refreshes all the information shown in 
the user interface.
</p>

<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="Context-management.html#Context-management" accesskey="1">Context management</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="Asynchronous-and-non_002dstop-modes.html#Asynchronous-and-non_002dstop-modes" accesskey="2">Asynchronous and non-stop modes</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="Thread-groups.html#Thread-groups" accesskey="3">Thread groups</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>

<hr>
<div class="header">
<p>
Next: <a href="GDB_002fMI-Command-Syntax.html#GDB_002fMI-Command-Syntax" accesskey="n" rel="next">GDB/MI Command Syntax</a>, Up: <a href="GDB_002fMI.html#GDB_002fMI" accesskey="u" rel="up">GDB/MI</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>
